package com.hyhy.hycloud.uaa.client;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.List;

/**
 * UAA client配置类
 *
 * @author Xuegui Yuan
 * @date 2018-09-25
 */
@Configuration
@Import(UserInfoResourceConfig.class)
public class UaaClientConfig extends WebMvcConfigurerAdapter {

    @Autowired
    UserInfoResourceService userInfoService;

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(new UserInfoArgumentResolver(userInfoService));
        argumentResolvers.add(new UserIdArgumentResolver(userInfoService));
    }
}
